import java.util.ArrayDeque;
import java.util.PriorityQueue;
import java.util.Queue;

public class Greed   {
    public static void main(String[] args) {
        int n = 3;
        int[][] arr = new int[n][2];
        int time = 10;
        int addTime = 15;
        for (int i = 0; i < n; i++) {
           arr[i][0] = time + 2;
           arr[i][1] = addTime + 1;

        }
        int num = minmumNumberOfHost(n,arr);
        System.out.println(num);
    }
    public static int minmumNumberOfHost (int n, int[][] startEnd) {
        // write code here
        PriorityQueue<Integer> queue = new PriorityQueue<>();
        int count = 0;
        for (int i = 0; i < n; i++) {
            int cur1 = startEnd[i][0];
            int cur2 = startEnd[i][1];
            if (queue.isEmpty() || cur1 < queue.peek()){
                count ++;
                queue.add(cur2);
            }else {
                queue.poll();
                queue.add(cur2);
            }
        }
        return count;
    }
}
